package com.shan.rest.service;

import com.alibaba.dubbo.rpc.RpcContext;
import com.alibaba.dubbo.rpc.protocol.rest.support.ContentType;
import com.shan.rest.model.User;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;

/**
 * Author: shanzheng <br/>
 * Description: <br/>
 * Date： 19:29 2017/9/25.<br/>
 * Modified By: <br/>
 */
@Path("user")
@Produces({MediaType.APPLICATION_JSON, ContentType.APPLICATION_JSON_UTF_8, MediaType.TEXT_XML})
public class UserServiceImpl implements IUserService {

    @GET
    @Path("{uid}")
    public User sayHello(@PathParam("uid") long userId) {
        System.out.println("input param uid :"+userId);
        User user=new User();
        user.setId(userId);
        user.setUserName("xbz");
        user.setPassword("1215xubin");
        System.out.println("remoteAddress:" + RpcContext.getContext().getRemoteAddressString());
        return user;
    }
}
